import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.context.WebApplicationContext;

import java.io.*;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;


public class Test {
    public static void main(String[] args) {
    }

    public int arithmeticTriplets(int[] nums, int diff) {
        int count = 0;
        int[] cnt = new int[201];
        for (int i = 0;i < nums.length;i++) {
            cnt[nums[i]] = 1;
            if (nums[i] - 2 * diff < 0) {
                continue;
            }
            if (cnt[nums[i] - diff] == 1 && cnt[nums[i] - 2 * diff] == 1 ) {
                count++;
            }
        }
        return count;
    }




}
